<!--
  - Copyright (c) 2018.
  - 北京九思金信科技有限公司对该文件内容保留所有权利。
  - 未经许可，不得私自拷贝、传播、发布、引用该文件内容，违者将被追究法律责任。
  -->

<template>
    <transition name="el-zoom-in-top">
        <el-form :model="searchParam" inline style="width: 100%;background: #F4F8F9;margin-bottom: 24px;">
            <el-row>
                <el-col :span="8">
                    <el-form-item label="客户名称:" prop="customerName">
                        <el-input v-model="searchParam.customerName" class="input-with-select"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="客户经理:" prop="managerId">
                        <ft-user-query class="input-with-select" :clearable="true" v-model="searchParam.managerId" :editable="true"
                                       style="width: 100%"></ft-user-query>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="所属部门:" prop="deptId">
                        <ft-dept-select v-model="searchParam.deptId" :clearable="true" :org="orgId" class="input-with-select"
                                        style="width: 100%"></ft-dept-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="8">
                    <el-form-item label="证件号码:" prop="identityNo">
                        <el-input v-model="searchParam.identityNo" class="input-with-select"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="客户类型:" prop="customerType">
                        <ft-enum-checkbox-query v-model="searchParam.customerType" service-name='lss-customer' :multiple="true"
                                                type-name='customerType' class="input-with-select"></ft-enum-checkbox-query>
                    </el-form-item>
                </el-col>

                <el-col :span="24">
                    <el-form-item label="审核状态:" prop="billStatus">
                        <ft-enum-checkbox-query v-model="searchParam.billStatus" service-name='lss-customer' :multiple="true"
                                                type-name='billStatus' class="input-with-select"></ft-enum-checkbox-query>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="变更类型:" prop="changeType">
                        <ft-enum-checkbox-query v-model="searchParam.changeType" service-name='lss-customer' :multiple="true"
                                                type-name='customerChangeType' class="input-with-select"></ft-enum-checkbox-query>
                    </el-form-item>
                </el-col>
            </el-row>
            <hr style="background-color: #EDEDED;border: none;height: 1px;margin: 0px"/>
            <el-row style="padding:16px 0px">
                <el-col align="right">
                    <el-button @click="reset" size="mini" style="margin-right: 24px;">重置</el-button>
                    <el-button @click="query" type="primary" size="mini" style="margin-right: 24px;">搜索</el-button>
                </el-col>
            </el-row>
        </el-form>
    </transition>
</template>

<script>
    export default {
        name: "CustomerQueryForm",
        components: {},
        mounted() {
            this.$http.get('/joys-rest/joys-master-data/orgs/default').then(resp => {
                this.orgId = resp.body.orgID
            }, resp => {
                this.$message.error('系统繁忙')
            })
        },
        data() {
            return {
                searchParam: {customerType: [], deptId: null},
                orgId: null
            }
        },
        methods: {
            reset() {
                this.searchParam = {}
            },
            query() {
                this.$emit('query', this.searchParam)
            }
        },
        watch:{
            searchParam(val){
                this.$emit('change',val)
            }
        }
    }
</script>

<style>
    .input-with-select {
        float: left;
        border-radius: 30px;
    }

    .input-with-select .el-input__inner {
        border-radius: 30px;
    }
</style>
